<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../vue.js"></script>
</head>
<body>

<div id="app">
    <my-component text="some message" number="1"></my-component>


    <!--当使用的不是字符串模板时，camelCase (驼峰式命名) 的 prop 需要转换为相对应的 kebab-case (短横线分隔式命名)
    字符串模板就是用''来包含-->
    <local-component number="asd"  number-or-string="adhk" require-string="require" default-number="123" :default-object="{msg:'123'}" custom-validator="123" ></local-component>

</div>


<script>

    Vue.component('my-component', {
        props: ['text', 'number'],
        template: '<p>hello vue component -- text文本：{{text}} --  number类型：{{typeof(number)}}</p>'
    })




    // 开发版本会有提示  现在不知道  什么是开发版本
    var app = new Vue({
        el: "#app",
        components: {
            'local-component': {
                props: {
                    number: Number,
                    numberOrString: [String, Number],
                    requireString: {type: String, require: true},
                    defaultNumber: {type: Number, default: 100},
                    defaultObject: {type: Object, default: {message: "default object message"}},
                    customValidator: {type: Number, validator: function (e) {return e > 10}}
                },
                template: '<p>number= {{number}},' +
                'numberOrString= {{numberOrString}} ,' +
                'requireString= {{requireString}} ,' +
                'defaultNumber ={{defaultNumber}} ,' +
                'defaultObject ={{defaultObject}} ,' +
                'customValidator ={{customValidator}}</p>'}

        }
    })


</script>

</body>
</html>